package cn.yunhe.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import cn.yunhe.entity.Proviences;
import cn.yunhe.util.DButil;

public class ProviencesDaoImpl implements IProviencesDao {
	Connection con = null;
	PreparedStatement ps = null;
	ResultSet rs = null;

	public List<Proviences> searchProviences() {
		List<Proviences> list = new ArrayList<Proviences>();	
		try {
			con = DButil.getCon();
			
			String sql = "select province from provinces";
			ps = con.prepareStatement(sql);
			rs = ps.executeQuery();
			while(rs.next()){
				Proviences proviences = new Proviences();
				proviences.setProvience(rs.getString("province"));				
				list.add(proviences);
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}finally{
			DButil.close(con, ps, rs);
		}
		return list;
	}

}
